/*
* @Author: Srain
* @Date:   2018-07-25 20:30:51
* @Last Modified by:   Srain 
* @Last Modified time: 2018-10-02 21:29:55
*/

'use strict';

require('page/common/nav/index.js');

var _mm             = require('util/mm.js');
var _volunteer      = require('service/volunteer-service.js');
var templateIndex   = require('./index.string');

// page 逻辑部分
var page = {
    init: function(){
        this.onLoad();
    },
    onLoad : function(){
        // 加载志愿信息
        this.getVolunteerList();
    },
    // 加载志愿者信息
    getVolunteerList : function(){
        var listHtml    = '',
            $tableStriped = $('.table-striped');

        $tableStriped.html('<div class="loading"></div>');

        _volunteer.getVolunteerList(function(res){
             listHtml = _mm.renderHtml(templateIndex, {
                list :  res
            });
            $tableStriped.html(listHtml);
        }, function(errMsg){
            _mm.errorTips(errMsg);
        });
    }
};
$(function(){
    page.init();
});